package com.dm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Controller
@SpringBootApplication
public class MybatisgeneraterApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(MybatisgeneraterApplication.class, args);
    }

    @RequestMapping("/")
    public String index() {
        return "index";
    }

    @RequestMapping("getTables.do")
    public String getTbales(Map<String, Object> map) {
        ArrayList<String> tables = new ArrayList<>();
        tables.add("asdasqwe");
        tables.add("qwec");
        tables.add("ffds");
        tables.add("asdqw");
        tables.add("qweefdf");
        tables.add("asdqwe");

        ArrayList<String> tables2 = new ArrayList<>();
        tables2.add("asdasqwe222");
        tables2.add("qwec222");
        tables2.add("ffds22");
        tables2.add("asdqw22");
        tables2.add("qweefdf22");
        tables2.add("asdqwe22");
        ArrayList<List> tablesData = new ArrayList<>();
        tablesData.add(tables);
        tablesData.add(tables2);
        map.put("data", tablesData);
        return "tables";
    }


    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(this.getClass());
    }
}
